using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Windows.Media;

namespace Microsoft.TeamFoundation.WorkItemTracking.Client
{
    public static class WorkItemExtender
    {

        public static FieldDefinition GetField(this WorkItem workItem, string referenceName)
        {
            foreach (FieldDefinition fd in workItem.Type.FieldDefinitions)
            {
                if (fd.ReferenceName == referenceName)
                {
                    return fd;
                }
            }
            throw new InvalidOperationException(String.Format("{0} field not found!", referenceName));
        }

    }
}
